/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.inteligencia.stage.business.dto;

import com.inteligencia.stage.business.dto.base.BaseDTO;
import com.inteligencia.stage.dataaccess.model.TperfilEventoPersonaVO;
import com.inteligencia.stage.dataaccess.model.TpersonaVO;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

/**
 *
 * @author igorov
 */
public class PersonaDTO extends BaseDTO {

    private int codigo;
    private String NumDoc;
    private String TipDoc;
    private String NomPer;//
    private String ApePat;//
    private String ApeMat;//
    private Date FecNac;
    private String Sexo;//
    private String Email;//
    private String Direc;
    private String Cel;//
    private String Pass;//
    private List<EventoDTO> eventoDTOs;

    public PersonaDTO() {
        eventoDTOs = new LinkedList<EventoDTO>();
    }

    public PersonaDTO(TpersonaVO tpersonaVO) {
        if (tpersonaVO != null) {

            eventoDTOs = new LinkedList<EventoDTO>();
            this.codigo = tpersonaVO.getNcodper();
            this.NumDoc = tpersonaVO.getCnumdoc();
            this.TipDoc = tpersonaVO.getCtipdoc();
            this.NomPer = tpersonaVO.getCnomper();
            this.ApePat = tpersonaVO.getCapepat();
            this.ApeMat = tpersonaVO.getCapemat();
            this.FecNac = tpersonaVO.getDfecnac();
            this.Sexo = tpersonaVO.getCsexo();
            this.Email = tpersonaVO.getCemail();
            this.Direc = tpersonaVO.getTdirec();
            this.Cel = tpersonaVO.getCcel();
            this.Pass = tpersonaVO.getCpassword();

            Set<TperfilEventoPersonaVO> eventos = tpersonaVO.getTperfilEventoPersonas();
            for (Iterator it = eventos.iterator(); it.hasNext();) {
                Object object = it.next();
                TperfilEventoPersonaVO tperfilEventoPersonaVO = (TperfilEventoPersonaVO) object;
                EventoDTO eventoDTO = new EventoDTO(tperfilEventoPersonaVO.getTevento());
                eventoDTOs.add(eventoDTO);
            }
        }

    }

    public PersonaDTO(int codigo, String NumDoc, String TipDoc, String NomPer, String ApePat, String ApeMat, Date FecNac, String Sexo, String Email, String Direc, String Cel, String Pass) {
        this.codigo = codigo;
        this.NumDoc = NumDoc;
        this.TipDoc = TipDoc;
        this.NomPer = NomPer;
        this.ApePat = ApePat;
        this.ApeMat = ApeMat;
        this.FecNac = FecNac;
        this.Sexo = Sexo;
        this.Email = Email;
        this.Direc = Direc;
        this.Cel = Cel;
        this.Pass = Pass;
    }

    public List<EventoDTO> getEventoDTOs() {
        return eventoDTOs;
    }

    public void setEventoDTOs(List<EventoDTO> eventoDTOs) {
        this.eventoDTOs = eventoDTOs;
    }

    public String getApeMat() {
        return ApeMat;
    }

    public void setApeMat(String ApeMat) {
        this.ApeMat = ApeMat;
    }

    public String getApePat() {
        return ApePat;
    }

    public void setApePat(String ApePat) {
        this.ApePat = ApePat;
    }

    public String getCel() {
        return Cel;
    }

    public void setCel(String Cel) {
        this.Cel = Cel;
    }

    public String getDirec() {
        return Direc;
    }

    public void setDirec(String Direc) {
        this.Direc = Direc;
    }

    public String getEmail() {
        return Email;
    }

    public void setEmail(String Email) {
        this.Email = Email;
    }

    public Date getFecNac() {
        return FecNac;
    }

    public void setFecNac(Date FecNac) {
        this.FecNac = FecNac;
    }

    public String getNomPer() {
        return NomPer;
    }

    public void setNomPer(String NomPer) {
        this.NomPer = NomPer;
    }

    public String getNumDoc() {
        return NumDoc;
    }

    public void setNumDoc(String NumDoc) {
        this.NumDoc = NumDoc;
    }

    public String getPass() {
        return Pass;
    }

    public void setPass(String Pass) {
        this.Pass = Pass;
    }

    public String getSexo() {
        return Sexo;
    }

    public void setSexo(String Sexo) {
        this.Sexo = Sexo;
    }

    public String getTipDoc() {
        return TipDoc;
    }

    public void setTipDoc(String TipDoc) {
        this.TipDoc = TipDoc;
    }

    public int getCodigo() {
        return codigo;
    }

    public void setCodigo(int codigo) {
        this.codigo = codigo;
    }

    public TpersonaVO toVO() {
        TpersonaVO tpersonaVO = new TpersonaVO();
        tpersonaVO.setNcodper(getCodigo());
        // tpersonaVO.setNcodper(codigo);
        tpersonaVO.setCnomper(NomPer);
        tpersonaVO.setCapepat(ApePat);
        tpersonaVO.setCapemat(ApeMat);
        tpersonaVO.setCcel(Cel);
        tpersonaVO.setCemail(Email);
        tpersonaVO.setCnumdoc(NumDoc);
        tpersonaVO.setCpassword(Pass);
        tpersonaVO.setCsexo(Sexo);
        tpersonaVO.setCtipdoc(TipDoc);
        tpersonaVO.setDfecnac(FecNac);
        tpersonaVO.setTdirec(Direc);
        //if (getCodigo() > 0) {
        //  tpersonaVO.setNcodusu(getCodigo());
        //}
        tpersonaVO.setDmodusu(new Date());
        return tpersonaVO;
    }
}
